<?php //debug($planosTags);  ?>
<div class="widget">
    <div class="whead"><h6>Tags de la orden : <?php echo $datosOrden['Ordene']['nombre']; ?></h6><div class="clear"></div></div>
    <div class="shownpars">
        <table cellpadding="0" cellspacing="0" border="0" class="dTable">
            <thead>
                <tr>
                    <th>Cod</th>
                    <th>Tags</th>
                    <th>Descripcion</th>
                    <th>Monto</th>
                    <th>Acciones</th>
                </tr>
            </thead>            
            <tbody>
                <?php $sum = 0; ?>
                <?php foreach ($ordenesTags as $ot): ?>
                    <?php $id = $ot['ot']['id']; ?>                    
                    <tr>
                        <td><?php echo $id; ?></td>
                        <td><?php echo $ot['ot']['tag_id']; ?></td>            
                        <td>
                            <?php
                            if ($ot['tags']['descripcion1'] == NULL)
                            {
                                echo 'NO TIENE';
                            }else
                            {
                                echo $ot['tags']['descripcion1'];
                            }
                            ?>
                        </td>       
                        <td>
                            <?php
                            $monto = $ot['ot']['monto'];
                            $montomod = $this->Number->format($monto, array(
                                'places' => 2,
                                'before' => ' ',
                                'escape' => false,
                                'decimals' => '.',
                                'thousands' => ','
                            ));
                            $sum += $monto;
                            echo $montomod;
                            ?>
                        </td>
                        <td>
                            <?php echo $this->Html->link('Editar', array('controller' => 'OrdenesTags', 'action' => 'editar', $id)); ?>&nbsp;&nbsp;&nbsp;&nbsp;
                            <?php echo $this->Html->link('Eliminar', array('controller' => 'OrdenesTags', 'action' => 'eliminar', $id), null, ('Desea aliminar este Documento.....!!!!!?')); ?>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
        <table cellpadding="0" cellspacing="0" width="100%" class="tDark">
            <thead>
            <th>Monto llenado</th>
            <th>Monto Sumado (Tags)</th>
            <th>Diferencia</th>
            </thead>
            <tbody>
            <?php        
             $montoPo = $datosOrden['Ordene']['monto'];
             $montoPomod = $this->Number->format($montoPo, array(
                'places' => 2,
                'before' => ' ',
                'escape' => false,
                'decimals' => '.',
                'thousands' => ','
            ));                                    
            ?>
            <td align="center"><h3><?php echo $montoPomod; ?></h3></td>     
            <td align="center">
                <h3>
                    <?php 
                        $summod = $this->Number->format($sum, array(
                            'places' => 2,
                            'before' => ' ',
                            'escape' => false,
                            'decimals' => '.',
                            'thousands' => ','
                        ));
                        echo $summod;
                    ?>
                </h3>
            </td>
            <td align="center">
                <h3>
                    <?php 
                    $montoPo = $datosOrden['Ordene']['monto'];
                    $resta = $montoPo - $sum;   
                        $resmod = $this->Number->format($resta, array(
                            'places' => 2,
                            'before' => ' ',
                            'escape' => false,
                            'decimals' => '.',
                            'thousands' => ','
                        ));
                        echo $resmod;
                    ?>
                </h3>
            </td>                  
            </tbody>
        </table>      
    </div>       
</div>     
<div class="actions-right">
<?php echo $this->Html->link('INSERTAR NUEVO TAGS', array('controller' => 'OrdenesTags', 'action' => 'insertar', $idOrden), array('class' => 'buttonS bGreen ')); ?>&nbsp;&nbsp;&nbsp;&nbsp;
    <?php echo $this->Html->link("Volver &raquo;", array('controller' => 'Ordenes', 'action' => 'index'), array('class' => 'buttonS bLightBlue', 'escape' => FALSE)); ?>
</div>